import {
  BaseEntity,
  Column,
  CreateDateColumn,
  DeleteDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { Mercadosku } from './mercadosku.entity';
import { Box } from './box.entity';

@Entity()
export class Mercadoproduct extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment: '名称',
    nullable: true,
    unique: false,
    default: null,
    type: 'varchar',
  })
  name: string;

  @Column({
    comment: '英文名称',
    nullable: true,
    unique: false,
    default: null,
  })
  enName: string;

  @Column({
    comment: '材质',
    nullable: true,
    unique: false,
    default: null,
  })
  material: string;

  @Column({
    comment: '美客多编号',
    nullable: true,
    unique: true,
    default: null,
    type: 'varchar',
  })
  mercadoNumber: string;

  @Column({
    comment: '名称',
    nullable: true,
    unique: true,
    default: null,
    type: 'varchar',
  })
  number: string;

  @Column({
    comment: '产品图片',
    nullable: true,
    unique: false,
    default: null,
    type: 'varchar',
  })
  image: string;

  @OneToMany(() => Mercadosku, (mercadosku) => mercadosku.mercadoproduct)
  mercadoskus: Mercadosku[];

  @OneToMany(() => Box, (box) => box.mercadoproduct)
  boxs: Box[];

  @CreateDateColumn()
  createTime: Date;

  @UpdateDateColumn()
  updateTime: Date;

  @DeleteDateColumn({ nullable: true })
  deleteTime: Date;
}
